#include "shm.hpp"
#include "namedPipe.hpp"

// client write
int main()
{
    Shm shm(gpathname, gproj_id, gUser);
    NamedPipe namedpipe(comm_path, User);

    namedpipe.OpenForWrite();        // 打开管道
    char *addr = (char *)shm.Addr(); // 返回shm首地址
    char ch = 'A';
    while (ch <= 'A')
    {
        
        strcpy(addr, "i am process A");

        // addr[ch - 'A'] = ch;
        // std::cout << addr[ch - 'A'] << std::endl;
        ch++;

        std::string temp = "After writing a message, start reading it";
        namedpipe.WriteNamedPipe(temp);
        sleep(1);
    }

    return 0;
}
